home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / flamoot / video.inc < prev    next >
Text File  |  1994-11-05  |  7KB  |  157 lines

  1. ;**********************************
  2. ;* FLamoot VGA SetUp include file *
  3. ;**********************************
  4.  
  5. EXTRN _SetVGA: FAR
  6. EXTRN _WaitVBL: FAR
  7. EXTRN _WaitHBL: FAR
  8.  
  9. VSYNC MACRO          ; Om de VBL te wachten...
  10.       call _WaitVBL
  11.       ENDM
  12.  
  13. MPUSH   MACRO reg1:REQ,reg2:VARARG   ; Vive Y.Roggeman/Greg & ses Macros
  14.         push reg1                    ; recursives !!!!!!! yahouuuuu !!!
  15.         IFNB <reg2>
  16.         MPUSH reg2
  17.         ENDIF
  18.         ENDM
  19.  
  20. MPOP    MACRO reg1:REQ,reg2:VARARG   ; bis bis !!!
  21.         IFNB <reg2>                  ; type brol = record....
  22.         MPOP reg2                    ; donc ça fait 20 bytes !!!
  23.         ENDIF                        ; donc 1 word ....
  24.         pop reg1                     ; brol je dis struct !!!
  25.         ENDM
  26.  
  27.  
  28. ;*** GFX-mode structure *** 
  29.  
  30. mode RECORD hgh:5, ver:3, hor:3, col:2, adr:2
  31. ;
  32. ; rem:   hgh = line doubling factor
  33. ;        ver = 0 --> 350 lines display     hor = 0 --> 128 horiz width
  34. ;              1     400 big                     1     160
  35. ;              2     400                         2     180
  36. ;              3     400 60hz                    3     256
  37. ;              4     448                         4     320
  38. ;              5     480                         5     360
  39. ;              6     512                         
  40. ;              7     540
  41. ;        col = 0 --> 256 colors display    adr = 0 --> planar scheme (X-mode)
  42. ;              1     16                          1 --> chained
  43. ;              2     4                           2 --> cga
  44. ;              3     text 16                     3 --> mono
  45. ;
  46. ; PS: if you choose a 16 colors display, the horiz width is doubled !!!!!
  47.  
  48. ; predefined modes ....
  49. ;-----------------------
  50. m160x67x256c      EQU mode<5,2,1,0,1>  ; 7-mode like
  51. m160x70x256c      EQU mode<4,0,1,0,1>  ; 7-mode like
  52. m160x80x256c      EQU mode<4,2,1,0,1>  ; 7-mode like
  53. m160x100x256c     EQU mode<3,2,1,0,1>  ; 7-mode
  54. m160x200x256p60hz EQU mode<1,3,1,0,0>  ; 7-mode like
  55. m320x67x256c      EQU mode<5,2,4,0,1>
  56. m320x70x256c      EQU mode<4,0,4,0,1>
  57. m320x80x256c      EQU mode<4,2,4,0,1>
  58. m320x100x256c     EQU mode<3,2,4,0,1>
  59. m320x200x256c     EQU mode<1,2,4,0,1>
  60. m320x200x256p60hz EQU mode<1,3,4,0,0>
  61. m320x400x256p     EQU mode<0,2,4,0,0>
  62. m320x400x256pbig  EQU mode<0,1,4,0,0>
  63. m320x480x256p     EQU mode<0,5,4,0,0>
  64.  
  65. ;misc. examples
  66. ;--------------
  67. m320x200x256p EQU mode<1,2,4,0,0>
  68. m320x240x256p EQU mode<1,5,4,0,0>
  69. m360x480x256p EQU mode<0,5,5,0,0>
  70. m256x256x256p EQU mode<1,6,3,0,0>
  71. m320x240x16p  EQU mode<1,5,1,1,0>
  72. m640x400x16p  EQU mode<0,2,4,1,0>
  73. m512x512x16p  EQU mode<0,6,3,1,0>
  74. m720x480x16p  EQU mode<0,5,5,1,0>
  75. m320x200x16c  EQU mode<1,2,1,1,1>
  76.  
  77. m320x400x256c EQU mode<0,2,4,0,1>
  78. m320x480x256c EQU mode<0,5,4,0,1>
  79. m320x448x256c EQU mode<0,4,4,0,1>
  80. m256x256x256c EQU mode<1,6,3,0,1>
  81.  
  82. m1440x480x4c  EQU mode<0,5,5,2,1>
  83. m720x480x16c  EQU mode<0,5,5,1,1>
  84.  
  85.  
  86. ; some constants and macros by -=MorFlame/TFL-TDV=-
  87.  
  88. ; ===  - Valeurs registres VGA -  ===
  89.                               
  90. VGA_Segment     EQU     0A000h                ; Segment mémoire vga
  91. ATTRIB_Ctrl     EQU     03C0h                 ; Contrôleur d'attribut VGA 
  92. GC_Index        EQU     03CEh                 ; Contrôleur graphique VGA 
  93. SC_Index        EQU     03C4h                 ; Contrôleur séquenceur VGA
  94. SC_Data         EQU     03C5h                 ; Port de données séq. VGA
  95. CRTC_Index      EQU     03D4h                 ; Contrôleur crt VGA
  96. CRTC_Data       EQU     03D5h                 ; Contrôleur données crt VGA
  97. MISC_OUTPUT     EQU     03C2h                 ; Registre VGA divers
  98. INPUT_1         EQU     03DAh                 ; Registre statut d'input #1
  99.                               
  100. DAC_WRITE_ADDR  EQU     03C8h                 ; Reg addr écriture DAVGA
  101. DAC_READ_ADDR   EQU     03C7h                 ; Reg addr lecture DAVGA
  102. PEL_DATA_REG    EQU     03C9h                 ; Reg données R/W DAC/PEL VGA
  103. PIXEL_PAN_REG   EQU     033h                  ; Index attr: Reg pixel pan
  104. MAP_MASK        EQU     002h                  ; Index seq : write map mask
  105. READ_MAP        EQU     004h                  ; Reg lect map GIndex
  106. START_DISP_HI   EQU     00Ch                  ; CRTIndex: display start hi
  107. START_DISP_LO   EQU     00Dh                  ; CRTIndex: display start lo
  108.                               
  109. MAP_MASK_PLANE1 EQU     00102h                ; Map Register + Plane 1 
  110. MAP_MASK_PLANE2 EQU     01102h                ; Map Register + Plane 2
  111. ALL_PLANES_ON   EQU     00F02h                ; Map Register + All Bit Planes
  112.  
  113. PLANE1_ON       EQU     0102h                              
  114. PLANE2_ON       EQU     0202h                              
  115. PLANE3_ON       EQU     0402h
  116. PLANE4_ON       EQU     0802h
  117.  
  118. CHAIN4_OFF      EQU     00604h                ; Chain 4 mode Off
  119. ASYNC_RESET     EQU     00100h                ; (A)synchronous Reset
  120. SEQU_RESTART    EQU     00300h                ; Sequencer Restart
  121.                               
  122. LATCHES_ON      EQU     00008h                ; Bit Mask + Data from Latches
  123. LATCHES_OFF     EQU     0FF08h                ; Bit Mask + Data from CPU 
  124.                                                                   
  125. VERT_RETRACE    EQU     08h                   ; INPUT_1: Vertical Retrace Bit
  126. PLANE_BITS      EQU     03h                   ; Bits 0-1 of Xpos = Plane #
  127. ALL_PLANES      EQU     0Fh                   ; All Bit Planes Selected
  128. CHAR_BITS       EQU     0Fh                   ; Bits 0-3 of Character Data
  129.                               
  130. GET_CHAR_PTR    EQU     01130h                ; VGA BIOS Func: Get Char Set 
  131. ROM_8x8_Lo      EQU     03h                   ; ROM 8x8 Char Set Lo Pointer 
  132. ROM_8x8_Hi      EQU     04h                   ; ROM 8x8 Char Set Hi Pointer 
  133.  
  134.  
  135. OUT_16 MACRO Register, Value
  136. ; Macro to OUT a 16 bit value to an I/O port
  137. IFDIFI <Register>, <DX>               ; If DX not setup
  138.     MOV             DX, Register  ; then Select Register
  139. ENDIF
  140. IFDIFI <Value>, <AX>                  ; If AX not setup 
  141.     MOV             AX, Value     ; then Get Data Value
  142. ENDIF
  143.     OUT             DX, AX        ; Set I/O Register(s)
  144. ENDM
  145.                               
  146. OUT_8 MACRO Register, Value
  147. ; Macro to OUT a 8 bit value to an I/O Port
  148. IFDIFI <Register>, <DX>               ; If DX not setup
  149.         MOV             DX, Register  ; then Select Register
  150. ENDIF
  151. IFDIFI <Value>, <AL>                  ; If AL not Setup
  152.         MOV             AL, Value     ; then Get Data Value
  153. ENDIF
  154.         OUT             DX, AL        ; Set I/O Register
  155. ENDM
  156.  
  157.